import VueRouter from 'vue-router'
import Vue from 'vue'
import PageA from '@/views/PageA'
import PageB from '@/views/PageB'
Vue.use(VueRouter)
const routes = [
  {path: '/',redirect: '/pageA'},
  { path: '/pageA',name: 'PageA', component: PageA },
  { path: '/pageB', component: PageB },
  {path: '/vuex-demo', component: () => import('@/views/VuexDemo.vue')}
]

// 3. 创建 router 实例，然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
const router = new VueRouter({
  mode: 'hash',
  routes // (缩写) 相当于 routes: routes
})
// router.beforeEach((to, from, next) => {
//   // ...
//   console.log(to, from, next)
//   next()

// })
console.log(router)
export default router